package com.ethink.warehouse.converter;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import com.ethink.framework.common.converter.Converter;
import com.ethink.warehouse.api.info.SubWarehouseInfo;
import com.ethink.warehouse.common.entity.SubWarehouse;

/**
 * 仓库分仓 Converter转换器
 *
 * @author default
 * @date 2022-11-01
 */
@Component
public class SubWarehouseConverter implements Converter<SubWarehouseInfo, SubWarehouse> {

    @Override
    public SubWarehouse convertTo(SubWarehouseInfo info) {
        if(info == null) {
            return null;
        }
        SubWarehouse entity = new SubWarehouse ();
        BeanUtils.copyProperties(info, entity);
        return entity;
    }

    @Override
    public SubWarehouseInfo convertFrom(SubWarehouse entity) {
        if(entity == null) {
            return null;
        }
        SubWarehouseInfo info = new SubWarehouseInfo();
        BeanUtils.copyProperties(entity, info);
        return info;
    }
}
